package unit10;

import java.awt.*;
import javax.swing.*;

public class Ex10_2_FlowLayoutTest {
    public static void main(String args[]) {
        JFrame f = new JFrame();
        // 组件对齐方式设定为左对齐
        f.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 20));
        JButton button1 = new JButton("Ok");
        JButton button2 = new JButton("Open");
        JButton button3 = new JButton("Close");
        //添加组件
        f.add(button1);
        f.add(button2);
        f.add(button3);
        f.setSize(300, 100);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
